import type { App } from 'vue';

import {
  Menu,
  Layout,
  Button,
  Row,
  Col,
  Card,
  Table,
  Dropdown,
  Tooltip,
  Input,
  Modal,
  Tabs,
  Form,
  Select,
  Tag,
  Radio,
  Divider,
  Popconfirm,
  Collapse,
  Switch,
  Descriptions,
  InputNumber,
  Popover,
  Upload,
  Breadcrumb,
  Anchor,
  Typography,
} from 'ant-design-vue';
import * as Icon from '@ant-design/icons-vue';

import 'ant-design-vue/dist/antd.css';

const plugins = [
  Menu,
  Layout,
  Button,
  Row,
  Col,
  Card,
  Table,
  Dropdown,
  Tooltip,
  Input,
  Modal,
  Tabs,
  Form,
  Select,
  Tag,
  Radio,
  Divider,
  Popconfirm,
  Collapse,
  Switch,
  Descriptions,
  InputNumber,
  Popover,
  Upload,
  Breadcrumb,
  Anchor,
  Typography,
];

export function setupAntd(app: App<Element>) {
  plugins.forEach((plugin) => {
    app.use(plugin);
  });
  Object.keys(Icon).forEach((key) => {
    app.component(key, Icon[key]);
  });
}
